import java.util.Scanner;

public class Test1 {
    //完全数个个数
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字：");
        while(scanner.hasNext()){
            int n = scanner.nextInt();
            int count = 0;
            for (int i = 1; i < n; i++) {
                int sum = 0;
                for (int j = 1; j < i; j++) {
                    if(i%j == 0){
                        sum += j;
                    }
                }
                if(sum == i){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
    //扑克牌大小
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] str1 = str.split("-");
        String[] str2 = str1[0].split(" ");
        String[] str3 = str1[1].split(" ");
        String s = "34567891JQKA2";
        if(str1[0].equals("joker JOKER") || str1[1].equals("joker JOKER")){
            System.out.println("joker JOKER");
        }else if(str2.length == str3.length){
            if(s.indexOf(str2[0].substring(0,1)) > s.indexOf(str3[0].substring(0,1))){
                System.out.println(str2[0]);
            }else{
                System.out.println(str3[1]);
            }
        }else if(str1.length == 4){
            System.out.println(str1[0]);
        }else if(str2.length == 4){
            System.out.println(str1[0]);
        }else{
            System.out.println("ERROR");
        }
    }
}
